/**
 * 
 */
package com.googlecode.bestpaper.output.pdf;

import java.awt.Color;
import java.io.IOException;

import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.pdf.BaseFont;

/**
 * @author xalinx at gmail dot com
 * @date Dec 4, 2009
 */
public class PDFHelper {
	private static BaseFont bf;
	static {
		try {
			//String fontname = PDFHelper.class.getResource("/fonts/MSYH.TTF").getFile();
//			String fontname = 
			bf = BaseFont.createFont("config/fonts/MSYH.TTF", BaseFont.IDENTITY_H,
					BaseFont.NOT_EMBEDDED);
		} catch (DocumentException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	private static final Color fontColor = new Color(0, 0, 0);

	private static final float fontSize = 14;

	private static final int DEFAULT_FONT_STYLE = Font.NORMAL;
	
	public static Font getCNFont(float size, int style, Color color) {
		return new Font(bf, size, style, color);
	}
	
	public static Font getCNFont(int fontStyle) {
		return new Font(bf, fontSize, fontStyle, fontColor);
	}
	
	public static Font getCNFont() {
		return getCNFont(DEFAULT_FONT_STYLE);
	}
}
